﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
namespace Movie.DAL
{
   public class LoginDAL
    {
       public static Modal.User  GetUser(string name)
       {
           string sql = string .Format("select * from Customer where Cname='{0}'",name);
           SqlDataReader reder = sqlHelper2.ExcuteReader(sql);          
           Modal.User user = null;
           if (reder.Read())
           {
               user = new Modal.User();
               user.CustID =Convert.ToInt32( reder["CustID"]);
               user.Cname = reder["Cname"].ToString();
               user.Cpwd = reder["Cpwd"].ToString();
               user.Cphone = reder["Cphone"].ToString();
               user.Crole = Convert.ToInt32(reder["Crole"]);
               user.CregisterTime = Convert.ToDateTime(reder["CregisterTime"]);
               user.Cphoto = reder["Cphoto"].ToString();
               user.Csex = reder["Csex"].ToString();
               user.Cemail = reder["Cemail"].ToString();
           }
           return user;
       }
    
   }
}
